Linux开发

推荐列表 站点导航

当前位置:首页 > 服务器技术 > Linux开发 >

linux解压.zip文件乱码处理的一个脚本

来源:互联网  作者:网友投稿  发布时间:2021-01-05 07:55
使用linux系统往往会下载windows平台编码的文件一般是.zip文件/ #!/usr/bin/env python2 # -*- coding: utf-8 -*- import os import sys im...

path if __name__ == __main__: argv = sys.argv main(argv) 复制代码可以另命名但后缀是py不要忘记他需要python解析, w) fo.write(data) fo.close except: pass file.close() def main(argv): ###################################################### # for argparse p = argparse.ArgumentParser(description=解决unzip乱码) p.add_argument(xxx, help=密码) global args args = p.parse_args(argv[1:]) xxx = args.xxx for path in xxx: if path.endswith(.zip): if os.path.exists(path): print s % (1, 用法: python2 unzip.py azipfile1.zip azipfile2.zip python2 unzip.py azipfile.zip -s secret 。

使用linux系统往往会下载windows平台编码的文件一般是.zip文件/ #!/usr/bin/env python2 # -*- coding: utf-8 -*- import os import sys import zipfile import argparse s = \x1b[%d;%dm%s\x1b[0m # terminual color template def unzip(path): file = zipfile.ZipFile(path,r) if args.secret: file.setpassword(args.secret) for name in file.namelist(): try: utf8name=name.decode(gbk) pathname = os.path.dirname(utf8name) except: utf8name=name pathname = os.path.dirname(utf8name) #print s % (1, 91, 91, utf8name #pathname = os.path.dirname(utf8name) if not os.path.exists(pathname) and pathname != : os.makedirs(pathname) data = file.read(name) if not os.path.exists(utf8name): try: fo = open(utf8name, path unzip(path) else: print s % (1, path else: print s % (1, nargs=*, --secret, ++ unzip:), 97, !! file isn\t a zip file.), \ help=命令对象.) p.add_argument(-s, 92。

type=str, !! file doesn\t exist.), extracting:), \ default=None, action=store,。

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/server/kaifa/11093.shtml

相关文章
Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

linux解压.zip文件乱码处理的一个脚本

2021-01-05 编辑:网友投稿

path if __name__ == __main__: argv = sys.argv main(argv) 复制代码可以另命名但后缀是py不要忘记他需要python解析, w) fo.write(data) fo.close except: pass file.close() def main(argv): ###################################################### # for argparse p = argparse.ArgumentParser(description=解决unzip乱码) p.add_argument(xxx, help=密码) global args args = p.parse_args(argv[1:]) xxx = args.xxx for path in xxx: if path.endswith(.zip): if os.path.exists(path): print s % (1, 用法: python2 unzip.py azipfile1.zip azipfile2.zip python2 unzip.py azipfile.zip -s secret 。

使用linux系统往往会下载windows平台编码的文件一般是.zip文件/ #!/usr/bin/env python2 # -*- coding: utf-8 -*- import os import sys import zipfile import argparse s = \x1b[%d;%dm%s\x1b[0m # terminual color template def unzip(path): file = zipfile.ZipFile(path,r) if args.secret: file.setpassword(args.secret) for name in file.namelist(): try: utf8name=name.decode(gbk) pathname = os.path.dirname(utf8name) except: utf8name=name pathname = os.path.dirname(utf8name) #print s % (1, 91, 91, utf8name #pathname = os.path.dirname(utf8name) if not os.path.exists(pathname) and pathname != : os.makedirs(pathname) data = file.read(name) if not os.path.exists(utf8name): try: fo = open(utf8name, path unzip(path) else: print s % (1, path else: print s % (1, nargs=*, --secret, ++ unzip:), 97, !! file isn\t a zip file.), \ help=命令对象.) p.add_argument(-s, 92。

type=str, !! file doesn\t exist.), extracting:), \ default=None, action=store,。

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/server/kaifa/11093.shtml

相关文章

风云图片

推荐阅读

返回Linux开发频道首页